{% extends 'news/base.html' %}
{% block style %}
    {% load static %}
    <link rel="stylesheet" href="{% static 'news/css/log.css' %}">
    <link rel="stylesheet" href="{% static 'news/css/register.css' %}">
{% endblock %}

{% block t_r %}
    <div id="user_down">
        <a href="{% url 'news:log' %}" ><span class="user_down_s1">登录</span></a>
        <span></span>
        <a href='{% url "news:register" %}'><span class="user_down_s2">注册</span></a>
    </div>
{% endblock %}


{% block top %}
    <div id="up">
        <p></p><div></div>Cnnews欢迎您-登陆
        <span>
            <span>还没有账号?</span>
            <a href="">立即注册</a>
        </span>
    </div>
{% endblock %}



{% block content %}
    <form action="{% url 'news:register_check' %}" method="post" id="down">
    {% csrf_token %}


        <input type="text" name="phone" placeholder="请输入手机号" id="phone_num">
        <span>{{ msg }}</span>
        <br>

        <input type="text" name="number" placeholder="请输入验证码" class="b1" id="yzm">

        <div id="code">获取验证码</div>
        <br>

        <input type="password" name="password1" placeholder="请输入6位以上的密码">
        <br>

        <input type="password" name="password2" placeholder="请再次输入密码">
        <br>

        <input type="submit" class="b3" value="注册">


    </form>
{% endblock %}
{% block js %}
    <script src="/static/js/jQuery.js"></script>
<script>
    {#$('#code').click(function () {#}
    {#    $.ajax({#}
    {#        type: "post",#}
    {#        url: "{% url 'news:code' %}",#}
    {#        data: {#}
    {#            email: $('#email').val()#}
    {##}
    {#        },#}
    {#        success: function (data) {#}
    {#            alert('发送成功');#}
    {#            console.log(data);#}
                {#alert(data['status_text'])#}
    {#        }#}
    {#    });#}
    {#});#}

     $('#code').click(function () {
            console.log($('#phone_num').val());
            $.ajax({
                type: "POST",
                url: "{% url 'news:code' %}",
                data: {'phone_num': $('#phone_num').val()},
                success: function (data1) {
                    console.log(data1);
                    if (data1['status_code'] == 0) {
                        $('#yzm').html(data1['yzm']);
                    }

                }
            });
        });


</script>
{% endblock %}
